package org.vison.wonfu.framework.soa.discovery;

import lombok.Data;
import lombok.Getter;

import java.util.Map;


@Getter
public class ServiceInstance {
    private final String serviceId;
    private final String appId;
    private final String host;
    private final int port;
    /**
     * 是否https
     */
    private boolean secure;

    public void setSecure(boolean secure) {
        this.secure = secure;
    }

    private Map<String,String> metaData;

    public void setMetaData(Map<String, String> metaData) {
        this.metaData = metaData;
    }

    public ServiceInstance(String appId, String host, int port) {
        this.host = host;
        this.port = port;
        this.appId = appId;
        this.serviceId = appId+"-"+host+":"+port;
    }

    @Override
    public String toString() {
        return "ServiceInstance{" +
                "serviceId='" + serviceId + '\'' +
                ", appId='" + appId + '\'' +
                ", host='" + host + '\'' +
                ", port=" + port +
                ", secure=" + secure +
                ", metaData=" + metaData +
                '}';
    }
}
